Routines (alphabetical) > Routines: E > EDGE_DOG

EDGE_DOG

Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

The EDGE_DOG function applies the Difference of Gaussians filter to a 2D image array to generate an array containing difference values that represent edges in the original image.

Syntax

Result = EDGE_DOG(Array [, RADIUS1=value] [, RADIUS2=value] [, THRESHOLD=value] [, ZERO_CROSSINGS=value])

Return Value

EDGE_DOG returns a signed difference array of the same shape as the input array. The input type is converted to an output type as follows:

Input

Output

BYTE

INT

INT

LONG

UINT

LONG

ULONG

LONG64

ULONG64

LONG64

Non-numeric types: not allowed

All other types

Same as input type

Arguments

Array

A 2D array of any numeric type containing the image.

Keywords

RADIUS1

RADIUS2

Set these keywords equal to scalars giving the radius in pixels of the Gaussian smoothing filters. The defaults are RADIUS1=3.0 and RADIUS2=5.0. The difference between the two RADIUS values influences the size of the features detected by the filter.

THRESHOLD

Set this keyword equal to a non-negative integer (or a float if Image is floating point) giving the clipping threshold. Gaussian differences that are smaller than this threshold are replaced with zero. This has the effect of removing small features from the result. It can be used to prevent noise in the image from being detected as edges. The default value is zero, meaning no thresholding is applied.

ZERO_CROSSINGS

Set this keyword equal to a two-element vector containing the values used to replace array values less than or equal to 0 and greater than zero, respectively. This creates a binary image useful for visualizing the edges.

Examples

The EDGE_DOG function can be used to isolate certain structures in an image, based on their size. This example isolates some of the bone structures in a CT scan.

file = FILEPATH('ctbone157.jpg', SUBDIR=['examples','data'])
READ_JPEG, file, image
IIMAGE, image, VIEW_GRID=[2,1], DIMENSIONS = [800, 500]
result = EDGE_DOG(image, RADIUS1=6.0, RADIUS2=20.0, THRESHOLD=15,$
   ZERO_CROSSINGS=[0,255])
IIMAGE, result, /VIEW_NEXT

When working with a multi-channel image, it is sometimes advantageous to combine the channels into a single luminance channel with COLOR_CONVERT:

file = FILEPATH('rose.jpg', SUBDIR=['examples','data'])
READ_JPEG, file, rose
COLOR_CONVERT, rose, yuv, /RGB_YUV
y = BYTE(REFORM(yuv[0,*,*])*255)
IIMAGE, EDGE_DOG(y, THRESHOLD=3, ZERO_CROSSINGS=[0,255])

Note: Also see “Detecting Edges” (Chapter 8, Image Processing in IDL)in the help/pdf directory of your IDL installation.

Version History

6.4

Introduced

See Also

EMBOSS, LAPLACIAN, PREWITT , ROBERTS , SHIFT_DIFF, SOBEL